跳到主要内容

Julia 函数文档模板

给函数写文档时,应该尽可能给函数本身或最宽泛的方法写,如果有必要再给其他方法写。

以下模板参考了 Julia SciML 风格指南和官方文档。

  1. 四个空格缩进的函数签名
  2. 一句话描述函数的行为,如有必要可以再加一段话详细描述
  3. 如有必要,提供 # Arguments
  4. 如有必要,提供 # Examples 段,可以使用 Julia 文档测试
  5. 提供指向其他函数的引用
"""
bar(x[, y])

Compute the Bar index between `x` and `y`.

If `y` is unspecified, compute the Bar index between all pairs of columns of `x`.

## Examples
`julia-repl
julia> bar([1, 2], [1, 2])
1
`
See also [`bar!`](@ref), [`baz`](@ref), [`baaz`](@ref).
"""
function bar(x, y) ...